import { defineNuxtPlugin } from '#app'
import ElementPlus, { ID_INJECTION_KEY } from 'element-plus'
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import VueLazyload from 'vue-lazyload';

export default defineNuxtPlugin(nuxtApp => {
   nuxtApp.vueApp.use(ElementPlus).provide(ID_INJECTION_KEY, {
      prefix: 1000,
      current: 0,
   })

   // 全局注册 element 图标
   Object.keys(ElementPlusIconsVue).forEach((key) => {
      nuxtApp.vueApp.component("ElIcon" + key, ElementPlusIconsVue[key as keyof typeof ElementPlusIconsVue]);
   });

   nuxtApp.vueApp.use(VueLazyload)
})